import java.util.Random;


/**
 * @author Yyming
 * @version 10.0
 * Created by Yyming on 2020/12/9
 */
public class CpuTest {
    static Random random = new Random();

    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        int arg = Integer.parseInt(args[0]);
        String str = "var widgetName = '${widgetName}'" +
                "var widget = _g().name_widgets[widgetName.toUpperCase()];\n" +
                "widget && widget.formHyperlink && widget.formHyperlink({para:${para}, widgetName:widgetName, animateType:'${animateType}'});\n" +
                "${titleAction}";
        for (int i = 0; i < arg; i++) {
            boolean matches = str.matches("^.*hyperlink.*$");
        }
        System.out.println("执行" + arg + "次matches耗时(单位ms)");
        System.out.println(System.currentTimeMillis() - start);
        start = System.currentTimeMillis();
        for (int i = 0; i < arg; i++) {
            str.replace("\n","");
        }
        System.out.println("执行" + arg + "次replace耗时(单位ms)");
        System.out.println(System.currentTimeMillis() - start);
    }

}
